package io.ouka.jvm.hotspot.selfread.read;

import io.ouka.jvm.hotspot.selfread.InstanceKlass;
import io.ouka.jvm.hotspot.selfread.constant.FinalConstant;
import io.ouka.jvm.hotspot.selfread.util.DataTranslate;

/**
 * @author ouka
 * AccessFlagsReader
 */
public class AccessFlagsReader extends AbstractReader {

    public AccessFlagsReader() {
        this.iReader = new ParentAndInterfaceDetailReader();
    }

    @Override
    public void preRead(byte[] content) {
        System.arraycopy(content, index, FinalConstant.U2BYTE, 0, FinalConstant.u2);
        index += FinalConstant.u2;
        this.selfContent = FinalConstant.U2BYTE;
    }

    @Override
    public void read() {
        instanceKlass.setAccessFLag(DataTranslate.byteToUnsignedShort(selfContent));

    }
}
